package com.doradance.account.utils;

import com.doradance.account.Account;
import com.doradance.app.MyApplication;
import com.pachong.android.frameworkbase.utils.io.SharePreferenceUtil;

import java.util.Date;

/**
 * Created by Administrator on 2018/3/13.
 */



public class ShareUtil {
    private static final String SP_FILENAME_ACCOUNT = Account.class.getSimpleName();

    //判断是否是会员
    public static String getIsMember(){
       return SharePreferenceUtil.getString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "is_member");
    }
    public static void setIsMember(String isMember){
        SharePreferenceUtil.saveString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "is_member", isMember);
    }

    //
    public static String getBabyId(){
        return SharePreferenceUtil.getString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "babyId");
    }
    public static void setBabyId(String babyId){
        SharePreferenceUtil.saveString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "babyId", babyId);;
    }

    public static Boolean getIsAuthorize(){
        return SharePreferenceUtil.getBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "authorize");
    }
    public static void setIsAuthorize(Boolean isAuthorize){
        SharePreferenceUtil.saveBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "authorize", isAuthorize);;
    }

    public static Boolean getIsStudy(){
        return SharePreferenceUtil.getBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "study");
    }

    public static void setIsIsStudy(Boolean isStudy){
        SharePreferenceUtil.saveBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "study",isStudy);;
    }

    public static Long getStartVideoTime(){
        return SharePreferenceUtil.getLong(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "startVideo");
    }
    /**
     * 设置视频的开始时间
     */
    public static void setStartVideoTime(){
        Date dt= new Date();
        Long time= dt.getTime();
        SharePreferenceUtil.saveLong(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "startVideo",time);;
    }

    public static Long getPauseVideoTime(){
        return SharePreferenceUtil.getLong(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "pauseVideo");
    }
    /**
     * 设置视频的结束时间
     */
    public static void setPauseVideoTime(){
        Date dt= new Date();
        Long time= dt.getTime();
        SharePreferenceUtil.saveLong(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "pauseVideo",time);;
    }

    /**
     * 保存课程的详情的key
     */
    public static String getDetailKey(){
        return SharePreferenceUtil.getString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "detailKey");
    }

    public static void setDetailKey(String detailKey){
        SharePreferenceUtil.saveString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "detailKey",detailKey);
    }

    /**
     * 保存课程的详情的key
     */
    public static String getCourseId(){
        return SharePreferenceUtil.getString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "courseId");
    }

    public static void setCourseId(String courseId){
        SharePreferenceUtil.saveString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "courseId",courseId);
    }

    public static Integer getChapterId(){
        return SharePreferenceUtil.getInt(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "chapterid");
    }

    public static void setChapterId(int chapterId){
        SharePreferenceUtil.saveInt(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "chapterid",chapterId);
    }

    public static void setFinalId(int finalId){
        SharePreferenceUtil.saveInt(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "finalId",finalId);
    }

    public static Integer getFinalId(){
        return SharePreferenceUtil.getInt(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "finalId");
    }

    public static Boolean getIsHot(){
        return SharePreferenceUtil.getBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "hot");
    }
    public static void setIsHot(Boolean isHot){
        SharePreferenceUtil.saveBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "hot", isHot);;
    }

    public static Boolean getIsNew(){
        return SharePreferenceUtil.getBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "new");
    }
    public static void setIsNew(Boolean isNew){
        SharePreferenceUtil.saveBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "new", isNew);
    }

    public static String getVipId(){
        return SharePreferenceUtil.getString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "vipid");
    }
    public static void setVipId(String vipId){
        SharePreferenceUtil.saveString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "vipid",vipId);;
    }

    public static String getAgeId(){
        return SharePreferenceUtil.getString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "ageid");
    }
    public static void setAgeId(String ageid){
        SharePreferenceUtil.saveString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "ageid",ageid);;
    }


    public static String getDifficult(){
        return SharePreferenceUtil.getString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "difficult");
    }
    public static void setDifficult(String difficult){
        SharePreferenceUtil.saveString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "difficult",difficult);;
    }


    public static Boolean getIs3G(){
        return SharePreferenceUtil.getBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "is3gCheck",true);
    }
    public static void setIs3G(Boolean is3G){
        SharePreferenceUtil.saveBoolean(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "is3gCheck", is3G);
    }

    public static Integer getShareChapterId(){
        return SharePreferenceUtil.getInt(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "sharechapterid");
    }

    public static void setShareChapterId(int chapterId){
        SharePreferenceUtil.saveInt(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "sharechapterid",chapterId);
    }
    public static Integer getShareCourseId(){
        return SharePreferenceUtil.getInt(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "sharecourseid");
    }

    public static void setShareCourseId(int courseId){
        SharePreferenceUtil.saveInt(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "sharecourseid",courseId);
    }

    /**
     * 保存当前宝宝的名字
     */
    public static String getBabyName(){
        return SharePreferenceUtil.getString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "babyName");
    }
    public static void setBabyName(String babyName){
        SharePreferenceUtil.saveString(MyApplication.getAppContext(), SP_FILENAME_ACCOUNT, "babyName",babyName);;
    }

}
